﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Contoso.Workflow.LocalService;
using Contoso.Workflow.Model;

public partial class UserControl_ExpenseFormRequestCheck : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (isUse)
        {
            if (!IsPostBack)
            {
                DBAccess dbAccess = new DBAccess();
                ExpenseData dbExpenseData = dbAccess.GetExpenseDataByInstanceID(expenseData.InstanceID);

                lblUser.Text = dbExpenseData.User;
                txtAccount.Text = dbExpenseData.Account.ToString();
                txtReason.Text = dbExpenseData.Reason;
                lblPMSuggestion.Text = dbExpenseData.PMSuggestion;
                lblGMSuggestion.Text = dbExpenseData.GMSuggestion;
            }
            else
            {
                expenseData.Account = double.Parse(txtAccount.Text);
                expenseData.Reason = txtReason.Text;
            }
        }
    }

    private bool isUse;
    public bool IsUse
    {
        get { return isUse; }
        set { isUse = value; }
    }
	

    private ExpenseData expenseData;
    public ExpenseData UCExpenseData
    {
        get { return expenseData; }
        set { expenseData = value; }
    }
}
